<?php
namespace Common\Model;

class CateModel extends CommonModel{
    
    protected $_validate = array(
        array('name','require','名称不能为空'),
        array('name','','该名称已经存在',0,'unique',1), //在新增的时候验证name字段是否唯一
        array('order_num','number','请填写序号数值'),
    );
    
    //获取行业
    public function getIndustry($page = ''){
        $row = array();
        $arr = $page ? $this->where(array('pid'=>0))->order('order_num asc')->page($page)->select() : $this->where(array('pid'=>0))->order('order_num asc')->select();
        foreach($arr as $v){
            $row[$v['id']] = $v['name'];
        }
        return $row;
    }

}